Refactor wizard operations into service#21
Merged
NB-Core merged 1 commit intoJul 13, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors several procedural wizard operations into the new WizardService class and removes the old helper PHP files.
- Migrated delete, insert, and view-toggle logic into
WizardServicemethods - Updated
list.phpand main dispatcher to call service methods instead of includes - Removed outdated
switchview.php,deleteempty.php,deletechecked.php, andinsert_central.phpfiles
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| systems/translationwizard/translationwizard/switchview.php | Removed; replaced by WizardService::toggleView |
| systems/translationwizard/translationwizard/list.php | Updated delete-checked handler to use WizardService::deleteCheckedRows |
| systems/translationwizard/translationwizard/insert_central.php | Removed; logic moved to WizardService::insertCentral |
| systems/translationwizard/translationwizard/deleteempty.php | Removed; logic moved to WizardService::deleteEmpty |
| systems/translationwizard/translationwizard/deletechecked.php | Removed; logic moved to WizardService::deleteCheckedRows |
| systems/translationwizard/translationwizard/WizardService.php | Added service methods: deleteCheckedRows, toggleView, deleteEmpty, insertCentral |
| systems/translationwizard/translationwizard.php | Main dispatcher updated to call new WizardService methods |
Comments suppressed due to low confidence (3)
systems/translationwizard/translationwizard/WizardService.php:184
- No tests accompany the new service methods. Consider adding unit or integration tests for deleteCheckedRows, toggleView, deleteEmpty, and insertCentral to verify behavior.
public static function deleteCheckedRows(string $language, string $namespace, array $texts): void {
systems/translationwizard/translationwizard/WizardService.php:203
- [nitpick] The method name deleteEmpty may not clearly convey its purpose. Consider renaming it to deleteRowsWithoutNamespace for clarity.
public static function toggleView(bool $currentView, string $from): void {
systems/translationwizard/translationwizard/list.php:8
- WizardService::ensureArray is not defined in WizardService. Implement this helper method or use a cast to array to avoid a fatal error.
WizardService::ensureArray($transintext)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WizardServicelist.phpand main dispatcherTesting
php -l systems/translationwizard/translationwizard/WizardService.phpphp -l systems/translationwizard/translationwizard/list.phpphp -l systems/translationwizard/translationwizard.phphttps://chatgpt.com/codex/tasks/task_e_68740ed96dec8329bd3718291b777ddf